package com.echoplots.json.serializer;

import java.io.IOException;

import com.echoplots.json.entity.Student;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class StudentSerializer extends JsonSerializer<Student>{
    @Override
    public void serialize(Student student, JsonGenerator generator, SerializerProvider provider)
            throws IOException, JsonProcessingException {
        generator.writeStartObject();
        generator.writeStringField("user-name", student.getUserName());
        generator.writeEndObject();
    }
}
